package data;

import java.util.HashMap;

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class Game {
	
	private Integer id;
	private Integer nbPlayers;
	private Integer status;
	private HashMap<Integer, Score> scores;
	
	public Game() { super(); }
	public Game (Integer id, Integer nbPlayers, Integer status) {
		this.setId(id);
		this.setNbPlayers(nbPlayers);
		this.setStatus(status);
		this.setScores(new HashMap<Integer, Score>());
	}
	public Game (Integer id, Integer nbPlayers, Integer status, HashMap<Integer, Score> scores) {
		this.setId(id);
		this.setNbPlayers(nbPlayers);
		this.setStatus(status);
		this.setScores(scores);
	}
	
	public Integer getId() { return id; }
	public Integer getNbPlayers() { return nbPlayers; }
	public Integer getStatus() { return status; }
	public HashMap<Integer, Score> getScores() { return scores; }
	public Game setId(Integer id) {
		this.id = id;
		return this;
	}
	public Game setNbPlayers(Integer nbPlayers) {
		this.nbPlayers = nbPlayers;
		return this;
	}
	public Game setStatus(Integer status) {
		if (status >= Game.NEW && status <= Game.FINISHED) {
			this.status = status;
		} else {
			this.status = Game.NEW;
		}
		return this;
	}
	public Game setScores(HashMap<Integer, Score> scores) {
		this.scores = scores;
		return this;
	}

	public static final Integer NEW		= 1;
	public static final Integer CURRENT	= 2;
	public static final Integer FINISHED	= 3;
	
}
